package com.example.compare;

import java.util.Objects;

/**
 * @author houyangfan
 * @version 1.0
 * @date 2022/7/20 18:39
 */
public class Point {

    private int x;
    private int y;

    private final String desc;

    public Point(int x, int y, String desc) {
        this.x = x;
        this.y = y;
        this.desc = desc;
    }

    /*@Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Point that = (Point) o;
        return x == that.x && y == that.y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }*/

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Point point = (Point) o;
        return x == point.x &&
                y == point.y &&
                Objects.equals(desc, point.desc);
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y, desc);
    }
}
